#include <QApplication>
#include <QTextCodec>

#include "mainwindow.h"
#include "logger.h"
#include "manager.h"
#include "defs.h"

int main(int argc, char *argv[])
{
    // For correct encoding
    QTextCodec *codec = QTextCodec::codecForName("UTF-8");
    QTextCodec::setCodecForCStrings(codec);

    Logger::CreateInstance();
    LOGGER->add("Main", "Логер створено");

    QApplication a(argc, argv);
    a.setOrganizationName(OrganisationName);
    a.setApplicationName(ApplicationName);
    a.setApplicationVersion(ApplicationVersion);
    a.setWindowIcon(QIcon(":/logo"));
    App->createInstance();
    App->mainWindow()->show();

    // Run app loop
    int result = a.exec();

    App->deleteInstance();
    LOGGER->add("Main", "Логер зупинено");
    Logger::DestroyInstance();
    return result;

}
